/**
 *  获取昨天
 * @param dateNow :Date类
 * @param intervalDays ：间隔天数
 * @param bolPastTime  ：Boolean,判断在参数date之前，还是之后，
 */
export function servingStateReasonscp(arr) {
  var arr1 = arr.length === 0 || !arr ? [] : arr
  let servingStateReasons1 = arr1.substring(1, arr1.length - 1)
  servingStateReasons1=servingStateReasons1.replace(/\"/g, "");
  if (servingStateReasons1.indexOf(',') === -1) {
    let arrs = []
    arrs.push(servingStateReasons1)
    arr1 = arrs
  } else {
    let servingStateReasons2 = servingStateReasons1.split(',')
    arr1 = servingStateReasons2
  }
  let str = []
  for (let i = 0; i < arr1.length; i++) {
    switch (arr1[i]) {
      case 'NO_PAYMENT_METHOD_ON_FILE':
        str.push("没有付款方式 -暂停状态")
        break
      case 'MISSING_BO_OR_INVOICING_FIELDS':
        str.push('预算订单缺失')
        break
      case 'PAUSED_BY_USER':
        str.push('已被用户暂停')
        break
      case 'DELETED_BY_USER':
        str.push('已被用户删除')
        break
      case 'CAMPAIGN_END_DATE_REACHED':
        str.push('广告系列已到结束日期')
        break
      case 'CAMPAIGN_START_DATE_IN_FUTURE':
        str.push('广告系列未到开始时间')
        break
      case 'DAILY_CAP_EXHAUSTED':
        str.push('日预算已耗尽')
        break
      case 'TOTAL_BUDGET_EXHAUSTED':
        str.push('总预算已耗尽')
        break
      case 'CREDIT_CARD_DECLINED':
        str.push('信用卡被拒绝')
        break
      case '"APP_NOT_ELIGIBLE"':
        str.push('不支持的应用程序')
        break
      case 'APP_NOT_ELIGIBLE_SEARCHADS':
        str.push('不支持搜索广告的应用程序')
        break
      case 'APP_NOT_PUBLISHED_YET':
        str.push('应用程序未上架')
        break
      case 'BO_START_DATE_IN_FUTURE':
        str.push('异常状态')
        break
      case 'BO_END_DATE_REACHED':
        str.push('异常状态')
        break
      case 'BO_EXHAUSTED':
        str.push('预算订单已用尽')
        break
      case 'ORG_PAYMENT_TYPE_CHANGED':
        str.push('广告系列的付款类型已更改')
        break
      case 'ORG_SUSPENDED_POLICY_VIOLATION':
        str.push('广告系列因违反策略而被暂停')
        break
      case 'ORG_SUSPENDED_FRAUD':
        str.push('广告系列停止投放')
        break
      case 'ORG_CHARGE_BACK_DISPUTED':
        str.push('广告系列收费异常')
        break
      case 'PAUSED_BY_SYSTEM':
        str.push('系统暂停-暂停状态')
        break
      case 'LOC_EXHAUSTED':
        str.push('缺少发票信息')
        break
      case 'TAX_VERIFICATION_PENDING':
        str.push('等待税务核实中')
        break
      case 'SAPIN_LAW_AGENT_UNKNOWN':
        str.push('-异常状态')
        break
      case 'SAPIN_LAW_FRENCH_BIZ_UNKNOWN':
        str.push('-异常状态')
        break
      case 'SAPIN_LAW_FRENCH_BIZ':
        str.push('-异常状态')
        break
      case 'MISSING_BO_OR_INVOICING_FIELDS':
        str.push("缺少预算订单")
        break
      case 'NO_ELIGIBLE_COUNTRIES':
        str.push("没有符合条件的国家")
        break
      case 'NO_AVAILABLE_AD_GROUPS':
        str.push("广告组未开启")
        break
      case 'AD_GROUP_MISSING':
        str.push('广告组缺失')
        break
      default:
        str = []
        break
    }
  }
  return str
}

export function servingStateReasonsad(arr) {
  var arr1 = arr === null ? [] : arr
  let servingStateReasons1 = arr1.substring(1, arr1.length - 1)
  servingStateReasons1=servingStateReasons1.replace(/\"/g, "");
  if (servingStateReasons1.indexOf(',') === -1) {
    let arrs = []
    arrs.push(servingStateReasons1)
    arr1 = arrs
  } else {
    let servingStateReasons2 = servingStateReasons1.split(',')
    arr1 = servingStateReasons2
  }
  var str = []
  for (let i = 0; i < arr1.length; i++) {
    switch (arr1[i]) {
      case 'AD_GROUP_PAUSED_BY_USER':
        str.push('已被用户暂停')
        break
      case 'DELETED_BY_USER':
        str.push('已被用户删除')
        break
      case 'ADGROUP_END_DATE_REACHED':
        str.push('已到达暂停时间')
        break
      case 'AUDIENCE_BELOW_THRESHOLD':
        str.push('异常状态')
        break
      case 'CAMPAIGN_NOT_RUNNING':
        str.push('广告系列暂停')
        break
      case 'START_DATE_IN_THE_FUTURE':
        str.push('未到开始时间')
        break
      case 'APP_NOT_SUPPORT':
        str.push('产品不支持投放')
        break
      case 'PENDING_AUDIENCE_VERIFICATION':
        str.push('等待验证')
        break

      default:
        str = []
        break
    }
  }
  return str
}
